<%@page import="org.jeecgframework.web.util.StaticValue"%>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@include file="/context/mytags.jsp"%>
<head>
    <title>巡检进度报告</title>
	<script type="text/javascript" src="plug-in/jquery/jquery-1.8.3.js"></script>
	<script type="text/javascript" src="plug-in/tools/curdtools_zh-cn.js"></script>
	<script type="text/javascript" src="plug-in/Highcharts-4.2.4/highcharts.js" ></script>
	<script type="text/javascript" src="plug-in/easyui/jquery.easyui.min.1.3.2.js"></script>
	<script type="text/javascript" src="plug-in/lhgDialog/lhgdialog.min.js"></script>
	<link rel="stylesheet" href="plug-in/easyui/themes/default/easyui.css" type="text/css"></link>
	<link rel="stylesheet" href="plug-in/easyui/themes/icon.css" type="text/css"></link>
	<link rel="stylesheet" href="plug-in/tools/css/common.css" type="text/css"></link>
	<style type="text/css">
	.tabs-header{background: white;}
	._btline_a{text-decoration: underline;color: blue;cursor: pointer;}
	</style>
<script type="text/javascript">
$(function(){
    var flag1 = false;
    var flag2 = false;
	$("#tabs").tabs({
		onSelect:function(title){
			if(title == '工程师满意度' && !flag1){//只加载一次
				getEgTableData($("#year_2").val(),$("#ipCompany_2").val());//默认根据默认年份加载
				initallEgHighChartsOfPillar();
				flag1 = true;
			}
			if(title == '维修工程师满意度' && !flag2){//只加载一次
			    getRepairEgTableData($("#year_4").val(),$("#ipCompany_4").val());//默认根据默认年份加载
			    initallRepairEgHighChartsOfPillar();
			    flag2=true;
			}
		}
	});
	
	getTpTableData($("#year_1").val(),$("#ipCompany_1").val(),$("#egId_1").val());
    getRepairTpTableData($("#year_3").val(),$("#ipCompany_3").val(),$("#egId_3").val());
    initallTpHighChartsOfLine();
	initallTpHighChartsOfPie();
	initallRepairTpHighChartsOfLine();
	initallRepairTpHighChartsOfPie();
});
/**------------------------第三方满意度-----------------------*/
function getTpTableData(year, ipCompany, egIds){
	var posData = {};
	posData.year = year;
	posData.ipCompany = ipCompany;
	if(egIds != undefined){
		posData.egIds = egIds;
	}
	$.ajax({
		url : "zyInspectionPlanController.do?queryIpEvaluateReportDataOfTp",
		data : posData,
		cache : false,
		async : false,//必须是同步进行，为了获取 初始化 highcharts 数据
		dataType : 'json',
		type : 'POST',
		success : function(data){
			if(data.success){
				clearTpLineData();//每次初始化表格时清空临时储存的highchart数据
				clearTpPieCharData();
				/*----------------表格-------------------*/
				var obj = data.obj;
				var html = "",rowTotal = 0;
				var lineCharArr = [],rowTotalArr = [];
				$(obj).each(function(r,item_r){
					html += '<tr>';
						$(item_r).each(function(c,item_c){
							if(c != 0 && c != 13){
								if(r == 0 || r == 1 || r == 2){
									rowTotalArr.push(parseFloat(item_c));
								}
								if(r >= 3 && r <= 7){
									if(item_c != 0){
										html += '<td><a onclick="goViewIeList('+ r +','+ c +')" class="_btline_a">'+ parseFloat(item_c) +'</a></td>';
									}else{
										html += '<td>'+ parseFloat(item_c) +'</td>';
									}
								}else{
									html += '<td>'+ (c == 0 ? item_c : parseFloat(item_c)) +'</td>';
								}			
							}else{
								html += '<td>'+ (c == 0 ? item_c : parseFloat(item_c)) +'</td>';
							}
							if(c == 13){
								rowTotal = parseFloat(item_c);
							}
						});
					html += '</tr>';
					if(r == 0){
						setTpLineData("平均分",rowTotalArr);
					}else if(r == 1){
						setTpLineData("评价总数",rowTotalArr);
					}else if(r == 2){
						setTpLineData("总任务数",rowTotalArr);
					}else if(r == 3){
						setTpPieCharData("5分",rowTotal);
					}else if(r == 4){
						setTpPieCharData("4分",rowTotal);
					}else if(r == 5){
						setTpPieCharData("3分",rowTotal);
					}else if(r == 6){
						setTpPieCharData("2分",rowTotal);
					}else if(r == 7){
						setTpPieCharData("1分",rowTotal);
					}
					rowTotal = 0;
					rowTotalArr = [];
				});
				if($("#tpTable tr").length > 1){ 
					$("#tpTable tr:gt(0)").remove();
				}
				$("#tpTable").append(html);
				/*------------------end 表格------------------*/
			}else{
				tip(data.msg);
			}
		}
	});
}


var ttLineCharData = [];
function clearTpLineData(){
	ttLineCharData = [];
}
function setTpLineData(name,dataArr){
	var dd = {};
	dd.name = name;
	dd.data = dataArr;
	dd.type = "column";
	dd.tooltip = {valueSuffix: ' 个'};
	if(name == "总任务数"){
		dd.yAxis = 1;
		ttLineCharData[0] = dd;
	}else if(name == "评价总数"){
		dd.yAxis = 1;
		ttLineCharData[1] = dd;
	}else if(name == "平均分"){
		dd.type = "spline";
		dd.tooltip = {valueSuffix: ' 分'};
		ttLineCharData[2] = dd;
	}
}
function getTpLineData(){
	return ttLineCharData;
}

var ttPieCharData = [];
function clearTpPieCharData(){
	ttPieCharData = [];
}
function setTpPieCharData(name,count){
	var data = {};
	data.name = name;
	data.count = count;
	ttPieCharData.push(data);
}
function getTpPieCharData(){
	var arr = new Array();
	$(ttPieCharData).each(function(i,item){
		var ar = new Array();
		ar[0] = item.name;
		ar[1] = item.count;
		arr.push(ar);
	});
	return arr;
}
function initallTpHighChartsOfLine(){
	/*-----------------维修第三方满意度 折线柱状图-------------------*/
	$("#tpLinePillarChartContainer").highcharts({
	    credits :{
	        text:'',
	        href:''
	    },
	    chart: {
	        zoomType: 'xy'
	    },
	    title: {
	        text: '满意度调查结果'
	    },
	    xAxis: [{
	        categories: ['1月', '2月', '3月', '4月', '5月', '6月', '7月', '8月', '9月', '10月', '11月', '12月']
	    }],
	    yAxis: [{ // Secondary yAxis
	        title: {
	            text: '分数'
	        },
	        labels: {
	            format: '{value}'
	        },
	        opposite: true,
	        tickPositioner: function () {
	        	return [1,2,3,4,5]
	        }
	    }, { // Primary yAxis
	        title: {
	            text: '数量'
	        },
	        labels: {
	            format: '{value}'
	        }
	    }],
	    tooltip: {
	        shared: true
	    },
	    series: getTpLineData()
	});
	/*-----------------end 第三方满意度 折线柱状图------------------*/
}


function initallTpHighChartsOfPie(){
	/*-------------------- 饼状图 -------------------------*/
	$("#highchartContainerOfTpPie").highcharts({
		credits: {//去水印
         	text: '',
         	href: ''
     	},
        chart: {
            plotBackgroundColor: null,
            plotBorderWidth: null,
            plotShadow: false
        },
        legend: {
            layout: 'vertical',
            align: 'right',
            verticalAlign: 'middle',
            x: 10,
            y: 20,
            borderWidth: 0,
            labelFormatter: function () {
                 return this.name + '<br/>&nbsp';
            },
            useHTML: true
       	},
        title: {
            text: '',
            style: {
            	'font-family':['Arial Negreta','Arial'],
	            'font-weight': '700',
	            'font-style': 'normal',
	            'font-size': '18px'
	            },
            x: -100
        },
        tooltip: {
    	    pointFormat: '数量：<b>{point.y}</b><br/>占比: <b>{point.percentage:.1f}%</b>'
        },
        plotOptions: {
            pie: {
                allowPointSelect: true,
                cursor: 'pointer',
                dataLabels: {
                    enabled: false
                },
                size :200,
                dataLabels: {
                	 enabled: true,
                     formatter: function() {
                        if(this.percentage > 0) return this.point.name + '：' + this.point.y + ' 占比:' + Highcharts.numberFormat(this.point.percentage,1) + '%';
                     },
                     color: 'black',
                     style: {
                        font: '13px Trebuchet MS, Verdana, sans-serif'
                     }
                },
                showInLegend: true
            }
        },
        series: [{
        	type :'pie',
        	name : '巡检问题',
        	data : getTpPieCharData()
        }]
    });
	/*-----------------end 饼状图------------------*/
}
/**------------------------第三方满意度-------end----------------*/

/**------------------------工程师满意度-----------------------*/
function getEgTableData(year, ipCompany, egIds){
	var posData = {};
	posData.year = year;
	posData.ipCompany = ipCompany;
	if(egIds != undefined){
		posData.egIds = egIds;
	}
	$.ajax({
		url : "zyInspectionPlanController.do?queryIpEvaluateReportDataOfEg",
		data : posData,
		cache : false,
		async : false,//必须是同步进行，为了获取 初始化 highcharts 数据
		dataType : 'json',
		type : 'POST',
		success : function(data){
			if(data.success){
				clearEgPillarCharData();//每次初始化表格时清空临时储存的highchart数据
				/*----------------表格-------------------*/
				var obj = data.obj;
				//highchart数据必须放在 平均分排序之前
				$(obj).each(function(r,item_r){
					setEgPillarCharData(item_r);
				});
				//平均分排序
				obj.sort(function(p1, p2){
					return parseFloat(p2[1]) - parseFloat(p1[1]); 
				});
				var html = "";
				$(obj).each(function(r,item_r){
					html += '<tr>';
					$(item_r).each(function(c,item_c){
						if(c == 0){
							html += '<td>' + item_c.egName + '</td>';
						}else{
							if(c >= 4 && c <= 8){
								if(item_c != 0){
									html += '<td><a onclick="goViewIeListInEg('+ c +',\''+ item_r[0].egId +'\')" class="_btline_a">' + item_c + '</a></td>';
								}else{
									html += '<td>' + item_c + '</td>';
								}
							}else{
								html += '<td>' + parseFloat(item_c) + '</td>';
							}
						}
					});
					html += '</tr>';
				});
				//初次加载不需要清除
				if($("#egTable tr").length > 1){ 
					$("#egTable tr:gt(0)").remove();
				}
				$("#egTable tr:eq(0)").after(html);
				
				/*------------------end 表格------------------*/
			}else{
				tip(data.msg);
			}
		}
	});
}

var egPillarCharData = [];
function clearEgPillarCharData(){
	egPillarCharData = [];
}
function setEgPillarCharData(item_r){
	var dt = {};
	dt.name = item_r[0].egName;
	dt.dataList = [parseFloat(item_r[4]),parseFloat(item_r[5]),parseFloat(item_r[6]),parseFloat(item_r[7]),parseFloat(item_r[8])];
	egPillarCharData.push(dt);
}
function getEgPillarCharData(){
	var chartData = {};
	var arr = new Array();
	var cats = [],sers = [];
	var score5 = {name:"5分",data:[]},score4 = {name:"4分",data:[]},score3 = {name:"3分",data:[]},score2 = {name:"2分",data:[]},score1 = {name:"1分",data:[]};
	$(egPillarCharData).each(function(i,item){
		cats.push(item.name);
		score5.data.push(item.dataList[0]);
		score5.color = "#91C7AE";
		score4.data.push(item.dataList[1]);
		score4.color = "#D58467";
		score3.data.push(item.dataList[2]);
		score3.color = "#C23531";
		score2.data.push(item.dataList[3]);
		score2.color = "#61A0A8";
		score1.data.push(item.dataList[4]);
		score1.color = "#2F4554";
	});
	sers.push(score5);
	sers.push(score4);
	sers.push(score3);
	sers.push(score2);
	sers.push(score1);
	chartData.series = sers;
	chartData.categories = cats;
	return chartData;
}
function initallEgHighChartsOfPillar(){
	/*-------------------工程师满意度 横向堆叠柱状图-----------------*/
	var categories = getEgPillarCharData().categories;
	var chart = Highcharts.chart("highchartContainerOfEgPillar",{
		credits: {//去水印
	         	text: '',
	         	href: ''
	     	},
        chart: {
            type: 'bar'
        },
        title: {
            text: '工程师评价分数图'
        },
        xAxis: {
            categories: getEgPillarCharData().categories,
            tickInterval:1// 刻度值  
        },
        yAxis: {
            min: 0,
            title: {
                text: ''
            }
        },
        legend: {
            reversed: true
        },
        plotOptions: {
            series: {
                stacking: 'normal'
            }
        },
        series: getEgPillarCharData().series
    });
	//调整chart 容器大小，因为 有的巡检商 工程师太多了，以至于显示不全
	$("#highchartContainerOfEgPillar").css("height",categories.length * 15);
	chart.reflow();
	/*-----------------end 工程师满意度 横向堆叠柱状图-----------------*/
}
/**------------------------工程师满意度-----------end------------*/


/**------------------------维修第三方满意度-----------------------*/
function getRepairTpTableData(year, ipCompany, egIds){
    var posData = {};
    posData.year = year;
    posData.ipCompany = ipCompany;
    if(egIds != undefined){
        posData.egIds = egIds;
    }
    $.ajax({
        url : "zyInspectionPlanController.do?queryIpRepairEvaluateReportDataOfTp",
        data : posData,
        cache : false,
        async : false,//必须是同步进行，为了获取 初始化 highcharts 数据
        dataType : 'json',
        type : 'POST',
        success : function(data){
            if(data.success){
                clearRepairTpLineData();//每次初始化表格时清空临时储存的highchart数据
                clearRepairTpPieCharData();
                /*----------------表格-------------------*/
                var obj = data.obj;
                var html = "",rowTotal = 0;
                var lineCharArr = [],rowTotalArr = [];
                $(obj).each(function(r,item_r){
                    html += '<tr>';
                    $(item_r).each(function(c,item_c){
                        if(c != 0 && c != 13){
                            if(r == 0 || r == 1 || r == 2){
                                rowTotalArr.push(parseFloat(item_c));
                            }
                            if(r >= 3 && r <= 7){
                                if(item_c != 0){
                                    html += '<td><a onclick="goRepairViewIeList('+ r +','+ c +')" class="_btline_a">'+ parseFloat(item_c) +'</a></td>';
                                }else{
                                    html += '<td>'+ parseFloat(item_c) +'</td>';
                                }
                            }else{
                                html += '<td>'+ (c == 0 ? item_c : parseFloat(item_c)) +'</td>';
                            }
                        }else{
                            html += '<td>'+ (c == 0 ? item_c : parseFloat(item_c)) +'</td>';
                        }
                        if(c == 13){
                            rowTotal = parseFloat(item_c);
                        }
                    });
                    html += '</tr>';
                    if(r == 0){
                        setRepairTpLineData("平均分",rowTotalArr);
                    }else if(r == 1){
                        setRepairTpLineData("评价总数",rowTotalArr);
                    }else if(r == 2){
                        setRepairTpLineData("总任务数",rowTotalArr);
                    }else if(r == 3){
                        setRepairTpPieCharData("5分",rowTotal);
                    }else if(r == 4){
                        setRepairTpPieCharData("4分",rowTotal);
                    }else if(r == 5){
                        setRepairTpPieCharData("3分",rowTotal);
                    }else if(r == 6){
                        setRepairTpPieCharData("2分",rowTotal);
                    }else if(r == 7){
                        setRepairTpPieCharData("1分",rowTotal);
                    }
                    rowTotal = 0;
                    rowTotalArr = [];
                });
                if($("#tpRepairTable tr").length > 1){
                    $("#tpRepairTable tr:gt(0)").remove();
                }
                $("#tpRepairTable").append(html);
                /*------------------end 表格------------------*/
            }else{
                tip(data.msg);
            }
        }
    });
}


var ttLineCharDataOfRepair = [];
function clearRepairTpLineData(){
    ttLineCharDataOfRepair = [];
}
function setRepairTpLineData(name,dataArr){
    var dd = {};
    dd.name = name;
    dd.data = dataArr;
    dd.type = "column";
    dd.tooltip = {valueSuffix: ' 个'};
    if(name == "总任务数"){
        dd.yAxis = 1;
        ttLineCharDataOfRepair[0] = dd;
    }else if(name == "评价总数"){
        dd.yAxis = 1;
        ttLineCharDataOfRepair[1] = dd;
    }else if(name == "平均分"){
        dd.type = "spline";
        dd.tooltip = {valueSuffix: ' 分'};
        ttLineCharDataOfRepair[2] = dd;
    }
}
function getRepairTpLineData(){
    return ttLineCharDataOfRepair;
}

var ttRepairPieCharData = [];
function clearRepairTpPieCharData(){
    ttRepairPieCharData = [];
}
function setRepairTpPieCharData(name,count){
    var data = {};
    data.name = name;
    data.count = count;
    ttRepairPieCharData.push(data);
}
function getRepairTpPieCharData(){
    var arr = new Array();
    $(ttRepairPieCharData).each(function(i,item){
        var ar = new Array();
        ar[0] = item.name;
        ar[1] = item.count;
        arr.push(ar);
    });
    return arr;
}
function initallRepairTpHighChartsOfLine(){
    /*-----------------维修第三方满意度 折线柱状图-------------------*/
    $("#tpRepairLinePillarChartContainer").highcharts({
        credits :{
            text:'',
            href:''
        },
        chart: {
            zoomType: 'xy'
        },
        title: {
            text: '满意度调查结果'
        },
        xAxis: [{
            categories: ['1月', '2月', '3月', '4月', '5月', '6月', '7月', '8月', '9月', '10月', '11月', '12月']
        }],
        yAxis: [{ // Secondary yAxis
            title: {
                text: '分数'
            },
            labels: {
                format: '{value}'
            },
            opposite: true,
            tickPositioner: function () {
                return [1,2,3,4,5]
            }
        }, { // Primary yAxis
            title: {
                text: '数量'
            },
            labels: {
                format: '{value}'
            }
        }],
        tooltip: {
            shared: true
        },
        series: getRepairTpLineData()
    });
    /*-----------------end 维修第三方满意度 折线柱状图------------------*/
}


function initallRepairTpHighChartsOfPie(){
    /*-------------------- 饼状图 -------------------------*/
    $("#highchartContainerOfTpRepairPie").highcharts({
        credits: {//去水印
            text: '',
            href: ''
        },
        chart: {
            plotBackgroundColor: null,
            plotBorderWidth: null,
            plotShadow: false
        },
        legend: {
            layout: 'vertical',
            align: 'right',
            verticalAlign: 'middle',
            x: 10,
            y: 20,
            borderWidth: 0,
            labelFormatter: function () {
                return this.name + '<br/>&nbsp';
            },
            useHTML: true
        },
        title: {
            text: '',
            style: {
                'font-family':['Arial Negreta','Arial'],
                'font-weight': '700',
                'font-style': 'normal',
                'font-size': '18px'
            },
            x: -100
        },
        tooltip: {
            pointFormat: '数量：<b>{point.y}</b><br/>占比: <b>{point.percentage:.1f}%</b>'
        },
        plotOptions: {
            pie: {
                allowPointSelect: true,
                cursor: 'pointer',
                dataLabels: {
                    enabled: false
                },
                size :200,
                dataLabels: {
                    enabled: true,
                    formatter: function() {
                        if(this.percentage > 0) return this.point.name + '：' + this.point.y + ' 占比:' + Highcharts.numberFormat(this.point.percentage,1) + '%';
                    },
                    color: 'black',
                    style: {
                        font: '13px Trebuchet MS, Verdana, sans-serif'
                    }
                },
                showInLegend: true
            }
        },
        series: [{
            type :'pie',
            name : '维修问题',
            data : getRepairTpPieCharData()
        }]
    });
    /*-----------------end 饼状图------------------*/
}
/**------------------------维修第三方满意度-------end----------------*/


/**------------------------维修工程师满意度-----------------------*/
function getRepairEgTableData(year, ipCompany, egIds){
    var posData = {};
    posData.year = year;
    posData.ipCompany = ipCompany;
    if(egIds != undefined){
        posData.egIds = egIds;
    }
    $.ajax({
        url : "zyInspectionPlanController.do?queryIpRepairEvaluateReportDataOfEg",
        data : posData,
        cache : false,
        async : false,//必须是同步进行，为了获取 初始化 highcharts 数据
        dataType : 'json',
        type : 'POST',
        success : function(data){
            if(data.success){
                clearRepairEgPillarCharData();//每次初始化表格时清空临时储存的highchart数据
                /*----------------表格-------------------*/
                var obj = data.obj;
                //highchart数据必须放在 平均分排序之前
                $(obj).each(function(r,item_r){
                    setRepairEgPillarCharData(item_r);
                });
                //平均分排序
                obj.sort(function(p1, p2){
                    return parseFloat(p2[1]) - parseFloat(p1[1]);
                });
                var html = "";
                $(obj).each(function(r,item_r){
                    html += '<tr>';
                    $(item_r).each(function(c,item_c){
                        if(c == 0){
                            html += '<td>' + item_c.egName + '</td>';
                        }else{
                            if(c >= 4 && c <= 8){
                                if(item_c != 0){
                                    html += '<td><a onclick="goRepairViewIeListInEg('+ c +',\''+ item_r[0].egId +'\')" class="_btline_a">' + item_c + '</a></td>';
                                }else{
                                    html += '<td>' + item_c + '</td>';
                                }
                            }else{
                                html += '<td>' + parseFloat(item_c) + '</td>';
                            }
                        }
                    });
                    html += '</tr>';
                });
                //初次加载不需要清除
                if($("#repairEgTable tr").length > 1){
                    $("#repairEgTable tr:gt(0)").remove();
                }
                $("#repairEgTable tr:eq(0)").after(html);

                /*------------------end 表格------------------*/
            }else{
                tip(data.msg);
            }
        }
    });
}

var egRepairPillarCharData = [];
function clearRepairEgPillarCharData(){
    egRepairPillarCharData = [];
}
function setRepairEgPillarCharData(item_r){
    var dt = {};
    dt.name = item_r[0].egName;
    dt.dataList = [parseFloat(item_r[4]),parseFloat(item_r[5]),parseFloat(item_r[6]),parseFloat(item_r[7]),parseFloat(item_r[8])];
    egRepairPillarCharData.push(dt);
}
function getRepairEgPillarCharData(){
    var chartData = {};
    var arr = new Array();
    var cats = [],sers = [];
    var score5 = {name:"5分",data:[]},score4 = {name:"4分",data:[]},score3 = {name:"3分",data:[]},score2 = {name:"2分",data:[]},score1 = {name:"1分",data:[]};
    $(egRepairPillarCharData).each(function(i,item){
        cats.push(item.name);
        score5.data.push(item.dataList[0]);
        score5.color = "#91C7AE";
        score4.data.push(item.dataList[1]);
        score4.color = "#D58467";
        score3.data.push(item.dataList[2]);
        score3.color = "#C23531";
        score2.data.push(item.dataList[3]);
        score2.color = "#61A0A8";
        score1.data.push(item.dataList[4]);
        score1.color = "#2F4554";
    });
    sers.push(score5);
    sers.push(score4);
    sers.push(score3);
    sers.push(score2);
    sers.push(score1);
    chartData.series = sers;
    chartData.categories = cats;
    return chartData;
}
function initallRepairEgHighChartsOfPillar(){
    /*-------------------维修工程师满意度 横向堆叠柱状图-----------------*/
    var categories = getRepairEgPillarCharData().categories;
    var chart = Highcharts.chart("highchartContainerOfRepairEgPillar",{
        credits: {//去水印
            text: '',
            href: ''
        },
        chart: {
            type: 'bar'
        },
        title: {
            text: '工程师评价分数图'
        },
        xAxis: {
            categories: getRepairEgPillarCharData().categories,
            tickInterval:1// 刻度值
        },
        yAxis: {
            min: 0,
            title: {
                text: ''
            }
        },
        legend: {
            reversed: true
        },
        plotOptions: {
            series: {
                stacking: 'normal'
            }
        },
        series: getRepairEgPillarCharData().series
    });
    //调整chart 容器大小，因为 有的巡检商 工程师太多了，以至于显示不全
    $("#highchartContainerOfRepairEgPillar").css("height",categories.length * 15);
    chart.reflow();
    /*-----------------end 工程师满意度 横向堆叠柱状图-----------------*/
}
/**------------------------维修工程师满意度-----------end------------*/


function setHighChartData(tab){
	if(tab == 1){
		var chartLine = $("#tpLinePillarChartContainer").highcharts();
		var lineDataArr = getTpLineData();
		for(var i = 0;i < lineDataArr.length;i++){
			chartLine.series[i].setData(lineDataArr[i].data);
		}
		
		var charPie = $("#highchartContainerOfTpPie").highcharts();
		charPie.series[0].setData(getTpPieCharData());
	}else if(tab == 2){
		var chart = $("#highchartContainerOfEgPillar").highcharts();
		var egPillarChartData = getEgPillarCharData();
		chart.xAxis[0].setCategories(egPillarChartData.categories);
		for(var i = 0;i < egPillarChartData.series.length;i++){
			chart.series[i].setData(egPillarChartData.series[i].data);
		}
		//调整chart 容器大小，因为 有的巡检商 工程师太多了，以至于显示不全
		$("#highchartContainerOfEgPillar").css("height",egPillarChartData.categories.length * 15);
		chart.reflow();
	}else if(tab == 3){
        var chartLine = $("#tpRepairLinePillarChartContainer").highcharts();
        var lineDataArr = getRepairTpLineData();
        for(var i = 0;i < lineDataArr.length;i++){
            chartLine.series[i].setData(lineDataArr[i].data);
        }

        var charPie = $("#highchartContainerOfTpRepairPie").highcharts();
        charPie.series[0].setData(getRepairTpPieCharData());
    }else if(tab == 4){
        var chart = $("#highchartContainerOfRepairEgPillar").highcharts();
        var egPillarChartData = getRepairEgPillarCharData();
        chart.xAxis[0].setCategories(egPillarChartData.categories);
        for(var i = 0;i < egPillarChartData.series.length;i++){
            chart.series[i].setData(egPillarChartData.series[i].data);
        }
        //调整chart 容器大小，因为 有的巡检商 工程师太多了，以至于显示不全
        $("#highchartContainerOfRepairEgPillar").css("height",egPillarChartData.categories.length * 15);
        chart.reflow();
    }
}
function searchReport(tab){
	var year = $("#year_"+tab).val();
	var ipCompany = $("#ipCompany_"+tab).val();
	var egId = $("#egId_"+tab).val();
	if(tab == 1){
		getTpTableData(year, ipCompany, egId);
	}else if(tab == 2){
		getEgTableData(year, ipCompany, egId);
	}else if(tab == 3){
        getRepairTpTableData(year, ipCompany, egId);
    }else if(tab == 4){
        getRepairEgTableData(year, ipCompany, egId);
    }
	setHighChartData(tab);
}
function goViewIeList(score, month){
	score = Math.abs(score -8);
	year = $("#year_1").val();
	ipCompany = $("#ipCompany_1").val();
	var url = "cbsInspectionEvaluateController.do?ieListOfIeReport&score="+score+"&year="+year+"&ipCompany="+ipCompany+"&month="+month;
	addOneTab("巡检评价",url)
}

function goRepairViewIeList(score, month){
	score = Math.abs(score -8);
	year = $("#year_3").val();
	ipCompany = $("#ipCompany_3").val();
	var url = "cbsInspectionEvaluateController.do?ieListOfIeReport&score="+score+"&year="+year+"&ipCompany="+ipCompany+"&month="+month+"&type=3";
	addOneTab("维修评价",url)
}

function goViewIeListInEg(score, egId){
	score = Math.abs(score - 9);
	year = $("#year_2").val();
	ipCompany = $("#ipCompany_2").val();
	var url = "cbsInspectionEvaluateController.do?ieListOfIeReport&score="+score+"&year="+year+"&ipCompany="+ipCompany+"&egId="+egId;
	addOneTab("巡检评价",url)
}

function goRepairViewIeListInEg(score, egId){
	score = Math.abs(score - 9);
	year = $("#year_4").val();
	ipCompany = $("#ipCompany_4").val();
	var url = "cbsInspectionEvaluateController.do?ieListOfIeReport&score="+score+"&year="+year+"&ipCompany="+ipCompany+"&egId="+egId+"&type=4";
	addOneTab("维修评价",url)
}
function exportReport(tab){
	var tableData = [],thOrTd = "th",table = "";
	var fileName = "报表.xlsx";
	if(tab == 1){
		fileName = "第三方满意度报表.xlsx";
		table = "tpTable";
	}else if(tab == 2){
		fileName = "工程师满意度报表.xlsx";
		table = "egTable";
	}else if(tab == 3){
        fileName = "维修第三方满意度报表.xlsx";
        table = "tpRepairTable";
	}else if(tab == 4){
        fileName = "维修工程师满意度报表.xlsx";
        table = "repairEgTable";
    }
	var ipCompany = $("#ipCompany_"+tab).val();
	ipCompany = ipCompany == undefined ? '' : ipCompany;
	$("#"+table+" tr").each(function(r,item_r){
		var rowData = [];
		if(r > 0){
			thOrTd = "td";
		}
		$(item_r).find(thOrTd).each(function(c,item_c){
			if($(item_c).has("a").length){
				rowData.push($(item_c).find("a").html());	
			}else{
				rowData.push($(item_c).html());	
			}
		});
		tableData.push(rowData.join(","));
	});
	var url = "zyInspectionReportController.do?exportIrReport";
	myDownload(url,"tableData="+tableData.join(";")+"&fileName='"+ fileName +"'&ipCompany="+ipCompany);
	
}
</script>
</head>
<body style="padding: 0px;margin: 0px auto;">
<c:if test="${not empty tpRoleUser && tpRoleUser}" >
	<input id="departId" type="hidden" value="${userDpId}" >
</c:if>
<div class="easyui-tabs" id="tabs">
	<div title="第三方满意度" style="overflow: hidden;">
		<div class="pad_l_10">
			<table width="100%">
				<tr>
					<td>
						<label class="report_label">巡检年度</label>
						<select id="year_1" style="width:85px;">
							<c:if test="${empty years}">
								<option>无</option>
							</c:if>
							<c:if test="${!empty years}">
								<c:forEach items="${years }" var="item">
									<option value="${item }">${item }&nbsp;年</option>
								</c:forEach>
							</c:if>
						</select>
					</td>
					<c:if test="${not empty tpRoleUser && tpRoleUser}" >
						<td>
							<label class="report_label">工程师</label>
							<input id="egId_1" type="hidden" >
							<input id="egName_1" readonly="readonly" style="width: 250px;" />
							<t:choose hiddenName="egId_1" hiddenid="id" inputTextname="egName_1" textname="name" paramIds="departId"
								title="工程师列表" url="zyEngineerController.do?goChooseEgsForIrReport" name="engineerList" width="660px" height="550px"
								icon="icon-search"  isclear="true" />
							<input id="ipCompany_1" type="hidden" value="${userDpCode}" >
						</td>
					</c:if>
					<c:if test="${empty tpRoleUser}">
						<td>
							<label class="report_label">服务单位</label>
							<t:dictSelect field="" id="ipCompany_1" typeGroupCode="<%=StaticValue.DIC_INSPECTION_COMPANY %>" />
						</td>
					</c:if>
					<td>
						<a href="javascript:void(0);" class="easyui-linkbutton" data-options="iconCls:'icon-search'" onclick="searchReport(1)">查询</a>
					</td>
				</tr>
			</table>
			<div style="text-align:right; padding-right:10px;">
				<a href="javascript:void(0);" class="easyui-linkbutton" data-options="iconCls:'icon-putout',plain:'true'" onclick="exportReport(1)">导出报告</a>
			</div>
			<hr />
			<table id="tpTable" class="report_table">
				<tr>
					<th >服务单位</th>
					<th >Jan</th>
					<th >Feb</th>
					<th >Mar</th>
					<th >Apr</th>
					<th >May</th>
					<th >Jun</th>
					<th >Jul</th>
					<th >Aug</th>
					<th >Sep</th>
					<th >Oct</th>
					<th >Nov</th>
					<th >Dec</th>
					<th >总计</th>
				</tr>
			</table>
			<br />
			<div id="tpLinePillarChartContainer" style="width: 46%;height:400px;display: inline-block;"></div>
			<div id="highchartContainerOfTpPie" style="width: 46%;height:400px;display: inline-block;"></div>
		</div>
	</div>
	<div title="工程师满意度" style="height:auto;">
		<div class="pad_l_10" >
			<table width="100%">
				<tr>
					<td>
						<label class="report_label">巡检年度</label>
						<select id="year_2" style="width:85px;">
							<c:if test="${empty years}">
								<option>无</option>
							</c:if>
							<c:if test="${!empty years}">
								<c:forEach items="${years }" var="item">
									<option value="${item }">${item }&nbsp;年</option>
								</c:forEach>
							</c:if>
						</select>
					</td>
					<c:if test="${not empty tpRoleUser && tpRoleUser}" >
						<td>
							<label class="report_label">工程师</label>
							<input id="egId_2" type="hidden" >
							<input id="egName_2" readonly="readonly" style="width: 250px;" />
							<t:choose hiddenName="egId_2" hiddenid="id" inputTextname="egName_2" textname="name" paramIds="departId"
								title="工程师列表" url="zyEngineerController.do?goChooseEgsForIrReport" name="engineerList" width="660px" height="550px"
								icon="icon-search"  isclear="true" />
							<input id="ipCompany_2" type="hidden" value="${userDpCode}" >
						</td>
					</c:if>
					<c:if test="${empty tpRoleUser}">
						<td>
							<label class="report_label">服务单位</label>
							<t:dictSelect field="" id="ipCompany_2" typeGroupCode="<%=StaticValue.DIC_INSPECTION_COMPANY %>" hasPleaseSelect="false" defaultVal="77"/>
						</td>
					</c:if>
					<td>
						<a href="javascript:void(0);" class="easyui-linkbutton" data-options="iconCls:'icon-search'" onclick="searchReport(2)">查询</a>
					</td>
				</tr>
			</table>
			<div style="text-align:right; padding-right:10px;">
				<a href="javascript:void(0);" class="easyui-linkbutton" data-options="iconCls:'icon-putout',plain:'true'" onclick="exportReport(2)">导出报告</a>
			</div>
			<hr />
			<div id="highchartContainerOfEgPillar" style="width: 90%;min-height:600px;height:auto;"></div>
			<br />
			<table id="egTable" class="report_table">
				<tr>
					<th>工程师</th>
					<th>评价平均分</th>
					<th>评价总数</th>
					<th>总任务数</th>
					<th>评价5分的数量</th>
					<th>评价4分的数量</th>
					<th>评价3分的数量</th>
					<th>评价2分的数量</th>
					<th>评价1分的数量</th>
				</tr>
			</table>
		</div>
	</div>
	<div title="维修第三方满意度" style="overflow: hidden;">
		<div class="pad_l_10">
			<table width="100%">
				<tr>
					<td>
						<label class="report_label">维修年度</label>
						<select id="year_3" style="width:85px;">
							<c:if test="${empty wxYears}">
								<option>无</option>
							</c:if>
							<c:if test="${!empty wxYears}">
								<c:forEach items="${wxYears }" var="item">
									<option value="${item }">${item }&nbsp;年</option>
								</c:forEach>
							</c:if>
						</select>
					</td>
					<c:if test="${not empty tpRoleUser && tpRoleUser}" >
						<td>
							<label class="report_label">工程师</label>
							<input id="egId_3" type="hidden" >
							<input id="egName_3" readonly="readonly" style="width: 250px;" />
							<t:choose hiddenName="egId_3" hiddenid="id" inputTextname="egName_1" textname="name" paramIds="departId"
								title="工程师列表" url="zyEngineerController.do?goChooseEgsForIrReport" name="engineerList" width="660px" height="550px"
								icon="icon-search"  isclear="true" />
							<input id="ipCompany_3" type="hidden" value="${userDpCode}" >
						</td>
					</c:if>
					<c:if test="${empty tpRoleUser}">
						<td>
							<label class="report_label">服务单位</label>
							<t:dictSelect field="" id="ipCompany_3" typeGroupCode="<%=StaticValue.DIC_INSPECTION_COMPANY %>" />
						</td>
					</c:if>
					<td>
						<a href="javascript:void(0);" class="easyui-linkbutton" data-options="iconCls:'icon-search'" onclick="searchReport(3)">查询</a>
					</td>
				</tr>
			</table>
			<div style="text-align:right; padding-right:10px;">
				<a href="javascript:void(0);" class="easyui-linkbutton" data-options="iconCls:'icon-putout',plain:'true'" onclick="exportReport(3)">导出报告</a>
			</div>
			<hr />
			<table id="tpRepairTable" class="report_table">
				<tr>
					<th >服务单位</th>
					<th >Jan</th>
					<th >Feb</th>
					<th >Mar</th>
					<th >Apr</th>
					<th >May</th>
					<th >Jun</th>
					<th >Jul</th>
					<th >Aug</th>
					<th >Sep</th>
					<th >Oct</th>
					<th >Nov</th>
					<th >Dec</th>
					<th >总计</th>
				</tr>
			</table>
			<br />
			<div id="tpRepairLinePillarChartContainer" style="width: 46%;height:400px;display: inline-block;"></div>
			<div id="highchartContainerOfTpRepairPie" style="width: 46%;height:400px;display: inline-block;"></div>
		</div>
	</div>
	<div title="维修工程师满意度" style="height:auto;">
		<div class="pad_l_10" >
			<table width="100%">
				<tr>
					<td>
						<label class="report_label">维修年度</label>
						<select id="year_4" style="width:85px;">
							<c:if test="${empty wxYears}">
								<option>无</option>
							</c:if>
							<c:if test="${!empty wxYears}">
								<c:forEach items="${wxYears }" var="item">
									<option value="${item }">${item }&nbsp;年</option>
								</c:forEach>
							</c:if>
						</select>
					</td>
					<c:if test="${not empty tpRoleUser && tpRoleUser}" >
						<td>
							<label class="report_label">工程师</label>
							<input id="egId_4" type="hidden" >
							<input id="egName_4" readonly="readonly" style="width: 250px;" />
							<t:choose hiddenName="egId_4" hiddenid="id" inputTextname="egName_4" textname="name" paramIds="departId"
								title="工程师列表" url="zyEngineerController.do?goChooseEgsForIrReport" name="engineerList" width="660px" height="550px"
								icon="icon-search"  isclear="true" />
							<input id="ipCompany_4" type="hidden" value="${userDpCode}" >
						</td>
					</c:if>
					<c:if test="${empty tpRoleUser}">
						<td>
							<label class="report_label">服务单位</label>
							<t:dictSelect field="" id="ipCompany_4" typeGroupCode="<%=StaticValue.DIC_INSPECTION_COMPANY %>" hasPleaseSelect="false" defaultVal="77"/>
						</td>
					</c:if>
					<td>
						<a href="javascript:void(0);" class="easyui-linkbutton" data-options="iconCls:'icon-search'" onclick="searchReport(4)">查询</a>
					</td>
				</tr>
			</table>
			<div style="text-align:right; padding-right:10px;">
				<a href="javascript:void(0);" class="easyui-linkbutton" data-options="iconCls:'icon-putout',plain:'true'" onclick="exportReport(4)">导出报告</a>
			</div>
			<hr />
			<div id="highchartContainerOfRepairEgPillar" style="width: 90%;min-height:600px;height:auto;"></div>
			<br />
			<table id="repairEgTable" class="report_table">
				<tr>
					<th>工程师</th>
					<th>评价平均分</th>
					<th>评价总数</th>
					<th>总任务数</th>
					<th>评价5分的数量</th>
					<th>评价4分的数量</th>
					<th>评价3分的数量</th>
					<th>评价2分的数量</th>
					<th>评价1分的数量</th>
				</tr>
			</table>
		</div>
	</div>
</div>
</body>
